/*
 ============================================================================
 Name        : TwoDivideConqure.c
 Author      : 
 Version     :
 Copyright   : Your copyright notice
 Description : Hello World in C, Ansi-style
 ============================================================================
 */

#include <stdio.h>
#include <stdlib.h>
int a[];

void swap(int *, int*);
void find(int *, int, int);
int main(void) {
	int index, out;
	for (index = 0; index < 100; index++)
		a[index] = index;
	find(a, 0, 99);
//	for (out = 0; out < 100; out++) {
//		printf("%d", a[out]);
//	}
	return 0;
}
void swap(int *a, int *b) {
	int middle;
	middle = *a;
	*a = *b;
	*b = middle;

}

void find(int *arr, int left, int right) {
	int mid = (left + right) >> 1;
	int v1 = left + 2, v2 = mid + 2;
	int l1 = 0, l2 = 1, r1 = mid, r2 = mid + 1;
	if (arr[l1] < arr[l2])
		swap(&l1, &l2);
	if (arr[r1] < arr[r2])
		swap(&r1, &r2);
	for (v1; v1 < mid; v1++) {
		if (arr[l2] < arr[v1]) {
			if (arr[l1] < arr[l2 = v1])
				swap(&l1, &l2);
		}

	}
	for (v2; v2 <= right; v2++) {
		if (arr[r2] < arr[v2]) {
			if (arr[r1] < arr[r2 = v2])
				swap(&r1, &r2);
		}
	}

	if (arr[l1] > arr[r1]) {
		printf("%d", arr[l1]);
		if (arr[l2] > arr[r1])
			printf("%d", arr[l2]);
		else {
			printf("%d", arr[r1]);
		}
	} else {
		printf("%d", arr[r1]);
		if (arr[l1] > arr[r2])
			printf("%d", arr[l1]);
		else {
			printf("%d", arr[r2]);
		}
	}

}
